GetCurrentSceneOffset
Offset = GetCurrentSceneOffset()
 
Parameters: NONE
Returns:

    Offset = The current offset (size) of the data captured ot the scene cache
 

      The GetCurrentSceneOffset function will return the current size of the Scene buffer cache. The scene buffer works much like a stack or heap, where the heap has a fixed size, if your program overflows the current scene buffer size, the it's bound to crash. You can of course expand the cache size by using the SceneCacheSize command.



FACTS:


      * None



Mini Tutorial:


      This example creates a camera, then resizes the scene buffer size from it's default of 460,000 bytes, to a much smaller 5000 bytes (5k) then captures some circles to the scene. As each circle is captured, it displays the current offset (amount of used space) in the scene buffer. Once eveything is captured it draws the camera to display the scene.


  
  
; create a new camera
  Cam=NewCamera()
  
; turn off auto cls in the camera
  CameraCls Cam,off
  
; Display the default size of the scene buffer
  Print "Scene Default Size:"+Str$(GetSceneCacheSize())
  
; Resize the Scene Cache Size to 5000 bytes (5 k)
  SceneCacheSize 5000
  
; Display the new size of the scene buffer
  Print "Scene New Size:"+Str$(GetSceneCacheSize())
  
  For Lp=0 To 10
   ; Tell PB to Capture the following gfx drawing commands
     CaptureToScene
     
   ; Draw a circle to the Scene buffer
     CircleC RndRange(100,800),RndRange(100,600),_
     RndRange(10,20),true,RndRGB()
     
   ; Tell PB to stop Capturing and return to
   ; drawing graphics immeditately
     DrawGFXImmediate
     
   ; Display the current Scene Buffer Cache offset
     Print "Cache Offset:"+Str$(GetCurrentSceneOffset())
  Next
  
; Display
  Print "done"
  
; call draw camera to display trhe captured items in the
; scene buffer
  DrawCamera Cam
  
; Show the Screen to the user and wait for a key press
  Sync
  WaitKey
  
  
  



In PlayBasic V1.63 this example will output the following text.

  
  Scene Buffer Default Size:459999
  Scene Buffer Custom Size:4999
  Cache Offset:132
  Cache Offset:264
  Cache Offset:396
  Cache Offset:528
  Cache Offset:660
  Cache Offset:792
  Cache Offset:924
  Cache Offset:1056
  Cache Offset:1188
  Cache Offset:1320
  Cache Offset:1452
  

 
Related Info: CameraBasics | CaptureToScene | DrawCamera | DrawGFXImmediate | GetSceneCacheSize | SceneCacheSize :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com